package ch.bfh.abcmmh.view.frame.subpanels;

import java.awt.BorderLayout;

import javax.swing.JPanel;

import ch.bfh.abcmmh.view.interfaces.TSSwingObjects;

public class StreetPanel extends JPanel implements TSSwingObjects {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private LineOnePanel lineOnePanel;

	public StreetPanel() {
		this.setLayout(new BorderLayout());
		this.lineOnePanel = new LineOnePanel();
		this.add(lineOnePanel);

	}

	@Override
	public void repaintSubsandMe() {

		repaint();
	}

	public JPanel getStreet() {
		return this.lineOnePanel.getStreet();
	}

	private class LineOnePanel extends JPanel implements TSSwingObjects {

		/**
		 * 
		 */
		private static final long serialVersionUID = 1L;
		
		private DriveLane rightLane;

		private LineOnePanel() {
			this.setLayout(new BorderLayout());
			this.rightLane = new DriveLane();
			this.add(rightLane, BorderLayout.CENTER);
		}

		@Override
		public void repaintSubsandMe() {
			rightLane.repaint();
			repaint();
		}

		private JPanel getStreet() {
			return rightLane.getStreet();
		}

	}

}
